# coding=utf-8
# 全世界最帅的帅哥
from flask import Blueprint
from flask_restful import Api
from ysgg1_club_auth.auth_domain.user_resource import (UserResource, LoginResource,
                                                       RegisterResource)
from ysgg1_club_auth.auth_domain.role_resource import RoleResource
from ysgg1_club_auth.auth_domain.permission_resource import PermissionResource
from ysgg1_club_auth.auth_domain.role_permission_resource import RolePermissionResource

user_bp = Blueprint('user', __name__, url_prefix="/user")
user_api = Api(user_bp)

user_api.add_resource(LoginResource, "/login", endpoint="login")
user_api.add_resource(RegisterResource, "/register", endpoint="register")
user_api.add_resource(UserResource, "/<int:user_id>", "/<string:action>", endpoint="user")
user_api.add_resource(RoleResource, "/role", "/role/<int:role_id>", endpoint="role")
user_api.add_resource(PermissionResource, "/permission", "/permission/<int:permission_id>",
                      "/permission/<string:action>",
                      endpoint="permission")
user_api.add_resource(RolePermissionResource, "/role_permission", endpoint="role_permission")